//
//  SelectTableViewCell.m
//  zhixinApp
//
//  Created by zhiguanzhl on 2017/11/21.
//  Copyright © 2017年 zhiguanzhl. All rights reserved.
//

#import "SelectTableViewCell.h"

@implementation SelectTableViewCell



- (void)awakeFromNib {
    [super awakeFromNib];
    ViewRadius(self.headBt, 45*0.5);
    
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.userInteractionEnabled = YES;
        self.accessoryView = nil;
        self.editingAccessoryView = nil;
        self.shouldIndentWhileEditing = NO;
    }
    return self;
}

- (void)setModel:(SelectModel *)model{
    _model = model;
    self.nameLable.text = model.name;
    self.countL.text = model.total;
}

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *cellID = @"SelectTableViewCell";
    SelectTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [[NSBundle mainBundle]loadNibNamed:@"SelectTableViewCell" owner:self options:nil].lastObject;
    }
    return cell;
}
- (IBAction)selectButton:(CustomButton *)sender {
    sender.selected = !sender.selected;
    
    
    if (sender.isSelected) {
        sender.mark = YES;
        
    }else{
        if (sender.mark == YES) {
            sender.mark = NO;
        }
    }
    if (self.block) {
        self.block(sender.mark);
    }
 
    
}


@end
